home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / SETUP / US / CBUILDER / DATA.Z / DOS.H < prev    next >
C/C++ Source or Header  |  1997-02-13  |  27KB  |  799 lines

  1. /*  dos.h
  2.  
  3.     Defines structs, unions, macros, and functions for dealing
  4.     with MSDOS and the Intel iAPX86 microprocessor family.
  5.  
  6. */
  7. /*
  8.  *      C/C++ Run Time Library - Version 8.0
  9.  *
  10.  *      Copyright (c) 1987, 1997 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14. /* $Revision:   8.3  $ */
  15.  
  16. #ifndef __DOS_H
  17. #define __DOS_H
  18.  
  19. #if !defined(___DEFS_H)
  20. #include <_defs.h>
  21. #endif
  22.  
  23.  
  24. #ifndef __cplusplus
  25. #if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED)
  26. #define _WCHAR_T
  27. #define _WCHAR_T_DEFINED  /* For WINDOWS.H */
  28. typedef unsigned short wchar_t;
  29. #endif
  30. #endif
  31.  
  32. #if !defined(RC_INVOKED)
  33.  
  34. #if defined(__STDC__)
  35. #pragma warn -nak
  36. #endif
  37.  
  38. #pragma pack(push, 1)
  39.  
  40. #endif  /* !RC_INVOKED */
  41.  
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47.  
  48. #define FA_NORMAL   0x00        /* Normal file, no attributes */
  49. #define FA_RDONLY   0x01        /* Read only attribute */
  50. #define FA_HIDDEN   0x02        /* Hidden file */
  51. #define FA_SYSTEM   0x04        /* System file */
  52. #define FA_LABEL    0x08        /* Volume label */
  53. #define FA_DIREC    0x10        /* Directory */
  54. #define FA_ARCH     0x20        /* Archive */
  55.  
  56. /* MSC names for file attributes */
  57. #define _A_NORMAL   0x00        /* Normal file, no attributes */
  58. #define _A_RDONLY   0x01        /* Read only attribute */
  59. #define _A_HIDDEN   0x02        /* Hidden file */
  60. #define _A_SYSTEM   0x04        /* System file */
  61. #define _A_VOLID    0x08        /* Volume label */
  62. #define _A_SUBDIR   0x10        /* Directory */
  63. #define _A_ARCH     0x20        /* Archive */
  64.  
  65. #define SEEK_CUR    1
  66. #define SEEK_END    2
  67. #define SEEK_SET    0
  68.  
  69.  
  70. #if !defined(__STDC__)
  71. #define environ  _environ
  72. #endif
  73.  
  74.  
  75. struct  dfree
  76. {
  77.     unsigned df_avail;
  78.     unsigned df_total;
  79.     unsigned df_bsec;
  80.     unsigned df_sclus;
  81. };
  82.  
  83. struct diskfree_t
  84. {
  85.     unsigned total_clusters;
  86.     unsigned avail_clusters;
  87.     unsigned sectors_per_cluster;
  88.     unsigned bytes_per_sector;
  89. };
  90.  
  91. struct time
  92. {
  93.     unsigned char   ti_min;     /* Minutes */
  94.     unsigned char   ti_hour;    /* Hours */
  95.     unsigned char   ti_hund;    /* Hundredths of seconds */
  96.     unsigned char   ti_sec;     /* Seconds */
  97. };
  98.  
  99. struct dostime_t
  100. {
  101.     unsigned char hour;         /* Hours */
  102.     unsigned char minute;       /* Minutes */
  103.     unsigned char second;       /* Seconds */
  104.     unsigned char hsecond;      /* Hundredths of seconds */
  105. };
  106.  
  107. struct date
  108. {
  109.     int     da_year;        /* Year - 1980 */
  110.     char    da_day;     /* Day of the month */
  111.     char    da_mon;     /* Month (1 = Jan) */
  112. };
  113.  
  114. struct dosdate_t
  115. {
  116.     unsigned char day;      /* 1-31 */
  117.     unsigned char month;    /* 1-12 */
  118.     unsigned int  year;     /* 1980 - 2099 */
  119.     unsigned char dayofweek;/* 0 - 6 (0=Sunday) */
  120. };
  121.  
  122. #if defined(__FLAT__)
  123.  
  124. #ifndef _FFBLK_DEF
  125. #define _FFBLK_DEF
  126. struct  ffblk   {
  127.     long            ff_reserved;
  128.     long            ff_fsize;
  129.     unsigned long   ff_attrib;
  130.     unsigned short  ff_ftime;
  131.     unsigned short  ff_fdate;
  132.     char            ff_name[256];
  133. };
  134. struct  _wffblk {
  135.     long            ff_reserved;
  136.     long            ff_fsize;
  137.     unsigned long   ff_attrib;
  138.     unsigned short  ff_ftime;
  139.     unsigned short  ff_fdate;
  140.     wchar_t         ff_name[256];
  141. };
  142.  
  143. #endif  /* __FFBLK_DEF */
  144.  
  145. struct find_t
  146. {
  147.     long            reserved;
  148.     long            size;              /* size of file */
  149.     unsigned long   attrib;            /* attribute byte for matched file */
  150.     unsigned short  wr_time;           /* time of last write to file */
  151.     unsigned short  wr_date;           /* date of last write to file */
  152.     char            name[256];         /* asciiz name of matched file */
  153. };
  154. #else  /* __FLAT__ */
  155.  
  156. #ifndef _FFBLK_DEF
  157. #define _FFBLK_DEF
  158. struct ffblk
  159. {
  160.     char        ff_reserved[21];
  161.     char        ff_attrib;
  162.     unsigned    ff_ftime;
  163.     unsigned    ff_fdate;
  164.     long        ff_fsize;
  165.     char        ff_name[13];
  166. };
  167. #endif  /* _FFBLK_DEF */
  168.  
  169. /* The MSC find_t structure corresponds exactly to the ffblk structure */
  170. struct find_t
  171. {
  172.     char     reserved[21];      /* Microsoft reserved - do not change */
  173.     char     attrib;            /* attribute byte for matched file */
  174.     unsigned wr_time;           /* time of last write to file */
  175.     unsigned wr_date;           /* date of last write to file */
  176.     long     size;              /* size of file */
  177.     char     name[13];          /* asciiz name of matched file */
  178. };
  179. #ifdef __MSC
  180. #define _find_t find_t
  181. #endif
  182.  
  183. #endif  /* !__FLAT__ */
  184.  
  185.  
  186. void                           __emit__(unsigned char __byte, ...);
  187. void     _RTLENTRY             __int__(int __interruptnum);
  188. unsigned _RTLENTRY  _EXPFUNC32 _dos_close(int __fd);
  189. unsigned _RTLENTRY  _EXPFUNC32 _dos_creat(const char _FAR *__pathP, unsigned __attr,
  190.                                           int _FAR *__fd);
  191. unsigned _RTLENTRY  _EXPFUNC32 _dos_creatnew(const char _FAR *__pathP, unsigned __attr,
  192.                                              int _FAR *__fd);
  193. unsigned _RTLENTRY  _EXPFUNC32 _dos_findfirst(const char _FAR *__path,
  194.                                               unsigned __attrib,
  195.                                               struct find_t _FAR *__finfo);
  196. unsigned _RTLENTRY  _EXPFUNC32 _dos_findnext(struct find_t _FAR *__finfo);
  197. void     _RTLENTRY  _EXPFUNC32 _dos_getdate(struct dosdate_t _FAR *__datep);
  198. unsigned _RTLENTRY  _EXPFUNC32 _dos_getdiskfree(unsigned __drive,
  199.                                                 struct diskfree_t _FAR *__dtable);
  200. void     _RTLENTRY  _EXPFUNC32 _dos_getdrive(unsigned _FAR *__drive);
  201. unsigned _RTLENTRY  _EXPFUNC32 _dos_getfileattr(const char _FAR *__filename,
  202.                                                 unsigned _FAR *__attrib);
  203. unsigned _RTLENTRY  _EXPFUNC32 _dos_getftime(int __fd, unsigned _FAR *__date,
  204.                                              unsigned _FAR *__time);
  205. void     _RTLENTRY  _EXPFUNC32 _dos_gettime(struct dostime_t _FAR *__timep);
  206. unsigned _RTLENTRY  _EXPFUNC32 _dos_open(const char _FAR *__pathP, unsigned __oflag,
  207.                                          int _FAR *__fd);
  208. unsigned _RTLENTRY  _EXPFUNC32 _dos_setdate(struct dosdate_t _FAR *__datep);
  209. void     _RTLENTRY  _EXPFUNC32 _dos_setdrive(unsigned __drive, unsigned _FAR *__ndrives);
  210. unsigned _RTLENTRY  _EXPFUNC32 _dos_setfileattr(const char _FAR *__filename,
  211.                                                 unsigned _FAR __attrib);
  212. unsigned _RTLENTRY  _EXPFUNC32 _dos_setftime(int __fd, unsigned __date, unsigned __time);
  213. unsigned _RTLENTRY  _EXPFUNC32 _dos_settime(struct dostime_t _FAR *__timep);
  214. void     _RTLENTRY  _EXPFUNC   disable(void);
  215. long     _RTLENTRY  _EXPFUNC   dostounix(struct date _FAR *__d, struct time _FAR *__t);
  216. void     _RTLENTRY  _EXPFUNC   enable(void);
  217. void     _RTLENTRYF _EXPFUNC32 getdate(struct date _FAR *__datep);
  218. void     _RTLENTRY  _EXPFUNC32 getdfree(unsigned char __drive,
  219.                                         struct dfree _FAR *__dtable);
  220. int      _RTLENTRY  _EXPFUNC32 _getdrive(void);
  221. void     _RTLENTRYF _EXPFUNC32 gettime(struct time _FAR *__timep);
  222. void     _RTLENTRY  _EXPFUNC32 setdate(struct date _FAR *__datep);
  223. void     _RTLENTRY  _EXPFUNC32 settime( struct time _FAR *__timep);
  224. void     _RTLENTRY  _EXPFUNC   unixtodos(long __time, struct date _FAR *__d,
  225.                                          struct time _FAR *__t);
  226. int      _RTLENTRYF _EXPFUNC32 unlink(const char _FAR *__path);
  227.  
  228.  
  229. #if defined(__FLAT__)
  230. unsigned _RTLENTRY  _EXPFUNC   _dos_read(int __fd, void *__buf, unsigned __len,
  231.                                          unsigned *__nread);
  232. unsigned _RTLENTRY  _EXPFUNC   _dos_write(int __fd, const void *__buf, unsigned __len,
  233.                                           unsigned *__nread );
  234. #else
  235. unsigned _RTLENTRY             _dos_read(int __fd, void __far *__buf, unsigned __len,
  236.                                          unsigned _FAR *__nread);
  237. unsigned _RTLENTRY             _dos_write(int __fd, const void __far *__buf, unsigned __len,
  238.                                           unsigned _FAR *__nread );
  239. #en